package com.itheima.dao;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface UserDao {


    @Select("select * from t_user where username=#{username}")
    @Results({
            @Result(column = "id",property = "id",id = true),
            @Result(column = "birthday",property = "birthday"),
            @Result(column = "gender",property = "gender"),
            @Result(column = "username",property = "username"),
            @Result(column = "password",property = "password"),
            @Result(column = "remark",property = "remark"),
            @Result(column = "station",property = "station"),
            @Result(column = "telephone",property = "telephone"),
            @Result(property = "roles",column = "id",many = @Many(select = "com.itheima.dao.RoleDao.findRolesByUserId"))
    })
    User findByName(String username);
}
